import web
from session.auth_decorator import AuthBase

class TwoAuth(AuthBase):
    # request handler
    def GET(self):
        self.setSessionCookie()
        
        path = web.ctx.path
        if(path == '/openid'):
            if self.isAuthed():
                web.seeother(web.ctx.get('HTTP_REFERER', '/'))
            else:
                self.doAuth()
            
        elif (path == '/openid_result'):
            self.openid_result_handler()
        elif (path == '/oauth_result'):
            self.oauth_result_handler()
